package com.lzy.managersystem.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzy.managersystem.mapper.UserMapper;
import com.lzy.managersystem.pojo.User;
import com.lzy.managersystem.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author qq619
* @description 针对表【sys_user】的数据库操作Service实现
* @createDate 2022-06-07 17:41:26
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
    implements UserService{

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> getAllUser() {
        return  userMapper.selectAll();

    }

    @Override
    public int insterUser(User user) {
       int flag= userMapper.insertSelective(user);
        return flag;
    }

    @Override
    public int deleteUser(Integer id) {
        int flag= userMapper.delById(id);
        return flag;
    }

    @Override
    public int updateUser(User user) {
        int flag = userMapper.updateSelective(user);
        return flag;
    }

    @Override
    public int deleteBatchUser(List<Integer> ids) {
        int flag = userMapper.deleteBatchIds(ids);
        return flag;
    }

    @Override
    public List<User> getTeacher(String role) {
        return userMapper.selectAllByRole(role);
    }


}




